home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_200
/
271_02
/
center.doc
< prev
next >
Wrap
Text File
|
1987-08-18
|
1KB
|
41 lines
NAME
center -- center a string
SYNOPSIS
r = center(string, size);
int r; starting column for centering
char *string; string to center
int size; width of field for centering
DESCRIPTION
This function returns the starting column to print a
string for the string to be centered in a field of
"size" characters. For the screen, the width would
usually be 80, and for printers, either 80 or 132.
The string MUST NOT BE longer than the size specified,
since there is no error cheking for this condition and
an unusable result will be returned.
EXAMPLE
char title[] = "Title of Program";
main() {
int i;
i = center(title, 80);
d_say(2, i, title); /* display title centered in row 2 */
}
This function is found in SMTCx.LIB for the Turbo-C Compiler